Basic IXI Visual Tcl architecture


An IXI Visual Tcl program consists of a main section and a number of procedures. The main section is invoked when the program first starts; it puts up display elements on the screen and then goes into a loop waiting for user input. The rest of the procedures are called in response to user input, such as pressing a button, or entering data into a text field. These procedures are referred to as callbacks. Thus, the program is event-driven.

The basic display element in IXI Visual Tcl is a widget such as a PushButton or Menu. The dialog widget is a special type of widget that presents a window on the screen and is used as a container for other widgets. A typical IXI Visual Tcl application presents the user with a number of dialogs and waits for the user to respond to the information.

Each of the widgets in a dialog can be customized with different options. For instance, the label on a PushButton, the items in a List, the size and position of the widget, fonts, and so on can all be configured.

Each widget is identified by a name. The programmer can specify options for each widget on the command line. These options include geometry options (such as the position of the widget), object class options (associated properties of the object, such as an error callback, font, height, width, and so on), label options (that define labels, accelerator keys and mnemonics), and form or dialog options (applicable only to forms or dialogs). There are also generic additional callback options that are applicable to any widget.

Widgets are defined hierarchically, similarly to the Tk conventions (see Tcl and the Tk Toolkit, John K. Outsterhout, Addison-Wesley 1994). Object names contain the entire widget hierarchy of the branch the widget resides on, to distinguish between identical child widgets located on different branches of the widget tree; for example:

toplevel.child1.child2.widget

Therefore, to create a widget it is usually only necessary to refer to its widget name (within the context of its parent object), but to modify or manipulate an existing widget it is necessary to use its object name (which is unique) to distinguish it from other widgets of the same type elsewhere in the applet. (An applet is a Tcl script that invokes IXI Visual Tcl; an application refers to the IXI Visual Tcl daemon, Tcl interpreter, and the applet script currently being executed.)

A IXI Visual Tcl applet consists of a tree of widgets that are managed by the IXI Visual Tcl application.

The application enters an event loop, displaying a form (or forms), collecting data returned by IXI Visual Tcl, and acting upon the data until the user wishes to leave the application. The program sets up the form and widgets on it, and executes the form using the VtMainLoop command. Execution of subtasks relies on the callback mechanism. When an exit condition is reached, a VtClose command is then issued, ending the application's connection to IXI Visual Tcl.